package com.magic.gre.mvp.presenter;

import com.google.gson.reflect.TypeToken;
import com.magic.gre.entity.StatisticalInfo;
import com.magic.gre.entity.base.BaseObjectModel;
import com.magic.gre.mvp.contract.MineContract;
import com.magic.gre.mvp.model.MineModelImpl;
import com.noname.lib_base_java.mvp.BasePresenterImpl;

/**
 * Author: Lmoumou
 * Date: 2019-01-07 15:33
 * 文件名: MinepresenterImpl
 * 描述:
 */
public class MinePresenterImpl extends BasePresenterImpl<MineContract.View, MineContract.Model>
        implements MineContract.Presenter {
    public MinePresenterImpl(MineContract.View view) {
        super(view);
    }

    @Override
    protected MineContract.Model creatModel() {
        return new MineModelImpl();
    }

    @Override
    public void pStatistical() {
        mModel.mStatistical(new CommonObserver<BaseObjectModel<StatisticalInfo>>(new TypeToken<BaseObjectModel<StatisticalInfo>>(){}.getType()) {
            @Override
            protected void onSuccess(BaseObjectModel<StatisticalInfo> baseObjectModel) {
                mView.vStatiscal(baseObjectModel.body);
            }

            @Override
            public void onError(int status, String msg) {

            }
        });
    }
}
